<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Material filter form base class.
 *
 * @package    hegeprosoft
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseMaterialFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'mat_nombreMaterial'      => new sfWidgetFormFilterInput(),
      'mat_ruta'                => new sfWidgetFormFilterInput(),
      'mat_descripcionMaterial' => new sfWidgetFormFilterInput(),
      'mat_faseMaterial'        => new sfWidgetFormPropelChoice(array('model' => 'Fase', 'add_empty' => true)),
      'mat_artefactoMaterial'   => new sfWidgetFormPropelChoice(array('model' => 'Artefactos', 'add_empty' => true)),
      'mat_actividad'           => new sfWidgetFormPropelChoice(array('model' => 'Actividad', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'mat_nombreMaterial'      => new sfValidatorPass(array('required' => false)),
      'mat_ruta'                => new sfValidatorPass(array('required' => false)),
      'mat_descripcionMaterial' => new sfValidatorPass(array('required' => false)),
      'mat_faseMaterial'        => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Fase', 'column' => 'fas_IdFase')),
      'mat_artefactoMaterial'   => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Artefactos', 'column' => 'art_IdArtefacto')),
      'mat_actividad'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Actividad', 'column' => 'act_IdActividad')),
    ));

    $this->widgetSchema->setNameFormat('material_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Material';
  }

  public function getFields()
  {
    return array(
      'IdMaterial'              => 'Number',
      'mat_nombreMaterial'      => 'Text',
      'mat_ruta'                => 'Text',
      'mat_descripcionMaterial' => 'Text',
      'mat_faseMaterial'        => 'ForeignKey',
      'mat_artefactoMaterial'   => 'ForeignKey',
      'mat_actividad'           => 'ForeignKey',
    );
  }
}
